<?php
//http://api.citygridmedia.com/content/places/v2/search/where?what=restaurant&where=chicago,IL&tag=11279&placement=sec-5&publisher=test

$term=urlencode($_GET["term"]);
$location=urlencode($_GET["location"]);

$unsigned_url = "http://api.citygridmedia.com/content/places/v2/search/where?what=".$term."&where=".$location."&format=json&publisher=10000005010";
$ch = curl_init($unsigned_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch); // Yelp response
curl_close($ch);
$yelp_response = json_decode($data);
$results = $yelp_response->results;
foreach ($results->locations as $location) {
    var_dump($location);
//    printf($location->name . " - " . $location->rating/2 . "<br/>");
}
?>
